﻿<ResourceDictionary
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:mr="http://mishrareader.codeplex.com/Reader">

    <Style x:Key="{x:Type TextBox}" TargetType="{x:Type TextBox}">
        <Setter Property="OverridesDefaultStyle" Value="True"/>
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="MinHeight" Value="26"/>
        <Setter Property="CaretBrush" Value="{DynamicResource MetroTextBoxCaret}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TextBox}">
                    <Border Name="Border" Background="{DynamicResource MetroTextBoxBg}" BorderBrush="{DynamicResource MetroTextBoxBg}" BorderThickness="1">
                        <ScrollViewer Margin="2,3,2,3" FontSize="13" x:Name="PART_ContentHost" />
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter TargetName="Border" Property="Opacity" Value="0.5"/>
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource MetroTextBoxBorderHover}"/>
                        </Trigger>
                        <Trigger Property="IsFocused" Value="True">
                            <Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource MetroTextBoxBorderHover}"/>
                            <Setter TargetName="Border" Property="Background" Value="{DynamicResource MetroTextBoxBgFocus}"/>
                        </Trigger>
                        <Trigger Property="Validation.HasError" Value="True">
                            <Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Self}, Path=(Validation.Errors)[0].ErrorContent}" />
                            <Setter TargetName="Border" Property="Background" Value="{DynamicResource MetroTextBoxErrorBg}" />
                            <Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource MetroTextBoxErrorBg}" />
                        </Trigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="Validation.HasError" Value="True" />
                                <Condition Property="IsMouseOver" Value="True" />
                            </MultiTrigger.Conditions>
                            <Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource MetroTextBoxErrorBorder}"/>
                        </MultiTrigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="Validation.HasError" Value="True" />
                                <Condition Property="IsFocused" Value="True" />
                            </MultiTrigger.Conditions>
                            <Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource MetroTextBoxErrorBorder}"/>
                            <Setter TargetName="Border" Property="Background" Value="{DynamicResource MetroTextBoxBgFocus}"/>
                        </MultiTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="Validation.ErrorTemplate">
            <Setter.Value>
                <ControlTemplate>
                    <AdornedElementPlaceholder />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="ContextMenu">
            <Setter.Value>
                <ContextMenu>
                    <MenuItem Header="Cut" Command="ApplicationCommands.Cut"/>
                    <MenuItem Header="Copy" Command="ApplicationCommands.Copy"/>
                    <MenuItem Header="Paste" Command="ApplicationCommands.Paste"/>
                </ContextMenu>
            </Setter.Value>
        </Setter>
    </Style>
    
    <Style x:Key="ShareTextBox" TargetType="{x:Type TextBox}" >
        
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TextBox}">
                    <Grid>
                		<Grid.RowDefinitions>
                			<RowDefinition Height="*" />
                			<RowDefinition Height="Auto" />
                		</Grid.RowDefinitions>
                		<VisualStateManager.VisualStateGroups>
                			<VisualStateGroup x:Name="CommonStates">
                				<VisualState x:Name="Normal"/>
                				<VisualState x:Name="Disabled"/>
                				<VisualState x:Name="ReadOnly"/>
                				<VisualState x:Name="MouseOver"/>
                			</VisualStateGroup>
                		</VisualStateManager.VisualStateGroups>
                		<Border x:Name="Border" SnapsToDevicePixels="True" UseLayoutRounding="True" Background="{DynamicResource MetroTextBoxBg}" BorderBrush="{DynamicResource MetroTextBoxBg}" BorderThickness="1">
                			<ScrollViewer HorizontalScrollBarVisibility="Disabled" Margin="2,3,2,3" FontSize="13" x:Name="PART_ContentHost" />
                		</Border>
                        <StackPanel Grid.Row="1" Orientation="Horizontal"	HorizontalAlignment="Right" Margin="0,-1,0,0">
                            <Grid  Width="24" Height="24">
                                <Rectangle x:Name="Shape" Fill="{DynamicResource MetroTextBoxBg}" SnapsToDevicePixels="True" UseLayoutRounding="True" Height="1" VerticalAlignment="Top" Margin="1,0"/>
                                <Path x:Name="Path" SnapsToDevicePixels="True" UseLayoutRounding="True" Data="M23.5,0.5 L23.5,23.5 0.5,0.5 " Fill="{DynamicResource MetroTextBoxBg}" Stretch="Fill" Stroke="{DynamicResource MetroTextBoxBg}" />
                            </Grid>
                            <TextBlock MinWidth="50" Margin="10,0" Text="{Binding Text.Length, Mode=Oneway, RelativeSource={RelativeSource TemplatedParent}}" VerticalAlignment="Bottom" Foreground="{DynamicResource MetroTextLight}" Grid.Row="1"	HorizontalAlignment="Right" />
                        </StackPanel>
							
                            
                	</Grid>
                    
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter TargetName="Border" Property="Opacity" Value="0.5"/>
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource MetroTextBoxBorderHover}"/>
							<Setter TargetName="Path" Property="Stroke" Value="{DynamicResource MetroTextBoxBorderHover}"/>
                        </Trigger>
                        <Trigger Property="IsFocused" Value="True">
                            <Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource MetroTextBoxBorderHover}"/>
                            <Setter TargetName="Border" Property="Background" Value="{DynamicResource MetroTextBoxBgFocus}"/>
                            <Setter TargetName="Path" Property="Stroke" Value="{DynamicResource MetroTextBoxBorderHover}" />
                            <Setter TargetName="Path" Property="Fill" Value="{DynamicResource MetroTextBoxBgFocus}" />
							<Setter TargetName="Shape" Property="Fill" Value="{DynamicResource MetroTextBoxBgFocus}" />
                        </Trigger>
                        <Trigger Property="Validation.HasError" Value="True">
                            <Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Self}, Path=(Validation.Errors)[0].ErrorContent}" />
                            <Setter TargetName="Border" Property="Background" Value="{DynamicResource MetroTextBoxErrorBg}" />
                            <Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource MetroTextBoxErrorBg}" />
							 <Setter TargetName="Path" Property="Fill" Value="{DynamicResource MetroTextBoxErrorBg}" />
                            <Setter TargetName="Path" Property="Stroke" Value="{DynamicResource MetroTextBoxErrorBg}" />
							<Setter TargetName="Shape" Property="Fill" Value="{DynamicResource MetroTextBoxErrorBg}" />
                        </Trigger>
                       
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        
    </Style>

    <Style x:Key="{x:Type RichTextBox}" TargetType="{x:Type RichTextBox}">
        <Setter Property="OverridesDefaultStyle" Value="True"/>
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="CaretBrush" Value="{DynamicResource MetroTextBoxCaret}" />
        <Setter Property="FontFamily" Value="Segoe UI"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RichTextBox}">
                    <Border Name="Border" Background="{DynamicResource MetroTextBoxBg}" BorderBrush="{DynamicResource MetroTextBoxBg}" BorderThickness="1">
                        <ScrollViewer Margin="2,3,2,3" FontSize="13" x:Name="PART_ContentHost" />
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter TargetName="Border" Property="Opacity" Value="0.5"/>
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource MetroTextBoxBorderHover}"/>
                        </Trigger>
                        <Trigger Property="IsFocused" Value="True">
                            <Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource MetroTextBoxBorderHover}"/>
                            <Setter TargetName="Border" Property="Background" Value="{DynamicResource MetroTextBoxBgFocus}"/>
                        </Trigger>
                        <Trigger Property="Validation.HasError" Value="True">
                            <Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Self}, Path=(Validation.Errors)[0].ErrorContent}" />
                            <Setter TargetName="Border" Property="Background" Value="{DynamicResource MetroTextBoxErrorBg}" />
                            <Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource MetroTextBoxErrorBg}" />
                        </Trigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="Validation.HasError" Value="True" />
                                <Condition Property="IsMouseOver" Value="True" />
                            </MultiTrigger.Conditions>
                            <Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource MetroTextBoxErrorBorder}"/>
                        </MultiTrigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="Validation.HasError" Value="True" />
                                <Condition Property="IsFocused" Value="True" />
                            </MultiTrigger.Conditions>
                            <Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource MetroTextBoxErrorBorder}"/>
                            <Setter TargetName="Border" Property="Background" Value="{DynamicResource MetroTextBoxBgFocus}"/>
                        </MultiTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="ContextMenu">
            <Setter.Value>
                <ContextMenu>
                    <MenuItem Header="Cut" Command="ApplicationCommands.Cut"/>
                    <MenuItem Header="Copy" Command="ApplicationCommands.Copy"/>
                    <MenuItem Header="Paste" Command="ApplicationCommands.Paste"/>
                </ContextMenu>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="{x:Type Hyperlink}" TargetType="{x:Type Hyperlink}">
        <Setter Property="OverridesDefaultStyle" Value="true"/>
        <Setter Property="Cursor" Value="Hand"/>
        <Setter Property="Foreground" Value="{DynamicResource MetroAccentBrush}" />
        <Setter Property="TextDecorations" Value="Underline" />
        <Style.Triggers>
            <Trigger Property="IsMouseOver" Value="true">
                <Setter Property="TextDecorations" Value="None" />
            </Trigger>
        </Style.Triggers>
    </Style>


    
    <Style x:Key="{x:Type mr:WatermarkTextBox}" TargetType="{x:Type mr:WatermarkTextBox}" BasedOn="{StaticResource {x:Type TextBox}}">
        <Setter Property="MinHeight" Value="26"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type mr:WatermarkTextBox}" >
                    <Border Name="Border" Background="{DynamicResource MetroTextBoxBg}" BorderBrush="{DynamicResource MetroTextBoxBg}" BorderThickness="1">
                        <Grid>
                            <ScrollViewer Margin="2,3,2,3" FontSize="13" x:Name="PART_ContentHost" />
                            <TextBlock x:Name="PART_Watermark" Text="{TemplateBinding Watermark}" 
                                       IsHitTestVisible="False" 
                                       Focusable="false" 
                                       Visibility="Collapsed" 
                                       HorizontalAlignment="Left" Margin="5,2" VerticalAlignment="Center" Style="{DynamicResource WaterMarkerTextBlock}" />
                        </Grid>
                        
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter TargetName="Border" Property="Opacity" Value="0.5"/>
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource MetroTextBoxBorderHover}"/>
                        </Trigger>
                        <Trigger Property="IsFocused" Value="True">
                            <Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource MetroTextBoxBorderHover}"/>
                            <Setter TargetName="Border" Property="Background" Value="{DynamicResource MetroTextBoxBgFocus}"/>
                        </Trigger>
                        <Trigger Property="Validation.HasError" Value="True">
                            <Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Self}, Path=(Validation.Errors)[0].ErrorContent}" />
                            <Setter TargetName="Border" Property="Background" Value="{DynamicResource MetroTextBoxErrorBg}" />
                            <Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource MetroTextBoxErrorBg}" />
                        </Trigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="Validation.HasError" Value="True" />
                                <Condition Property="IsMouseOver" Value="True" />
                            </MultiTrigger.Conditions>
                            <Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource MetroTextBoxErrorBorder}"/>
                        </MultiTrigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="Validation.HasError" Value="True" />
                                <Condition Property="IsFocused" Value="True" />
                            </MultiTrigger.Conditions>
                            <Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource MetroTextBoxErrorBorder}"/>
                            <Setter TargetName="Border" Property="Background" Value="{DynamicResource MetroTextBoxBgFocus}"/>
                        </MultiTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="ContextMenu">
            <Setter.Value>
                <ContextMenu>
                    <MenuItem Header="Cut" Command="ApplicationCommands.Cut"/>
                    <MenuItem Header="Copy" Command="ApplicationCommands.Copy"/>
                    <MenuItem Header="Paste" Command="ApplicationCommands.Paste"/>
                </ContextMenu>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>